import com.weimai.message.gateway.constant.Constant;
import com.weimai.message.gateway.filter.AuthFilter;
import com.weimai.message.gateway.util.SignUtil;

import java.util.TreeMap;

/**
 * 描述：
 * Copyright (c) 2018 Choice, Inc.
 * All Right Reserved.
 * Choice Proprietary and Confidential.
 *
 * @Author geer
 * @Since 2018/11/12
 * @Version 1.0
 **/
public class TestGenSignature {
    
    public static void main(String[] args){
        
        TreeMap<String, String> treeMap = new TreeMap();
        treeMap.put(Constant.X_CA_KEY, "Zsc71vHM0S4W9CCE");
        treeMap.put(Constant.X_CA_NONCE, "5RdPcGYFI8u058o70G68si1Apx3");
        treeMap.put(Constant.X_CA_TIMESTAMP, "1542556245585");
        treeMap.put("method", "POST");
        treeMap.put("path", "/notify/v1/sms/send/text");
        treeMap.put("phoneNumbers", "135885451111");
        //treeMap.put("id", "1");
        
        String sourceSignString = AuthFilter.buildSignString(treeMap);
        System.out.println(sourceSignString);
        String result = SignUtil.sha256_HMAC(sourceSignString, "123456789");
        
        System.out.println(result);
    }
}
